var n;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DebugMgr = undefined;
var BundleConfig = require("AA_BundleConfig");
var UI_Debug = require("AA_UI_Debug");
var GameConfig = require("AA_GameConfig");
var ResLoader = require("AA_ResLoader");
var ResUtil = require("AA_ResUtil");
var SingletonManager = require("AA_SingletonManager");
var l = function (e) {
  function t() {
    var t = null !== e && e.apply(this, arguments) || this;
    t._debug = null;
    t._logs = [];
    t._isLoadRes = false;
    return t;
  }
  __extends(t, e);
  t.prototype.addLog = function (e) {
    this._logs.push(e);
    if (this._debug) {
      this._doDebug();
    } else {
      this._getDebug();
    }
  };
  t.prototype.rmLog = function (e) {
    var t = this._logs.indexOf(e);
    t >= 0 && this._logs.splice(t, 1);
    this._doDebug();
  };
  t.prototype.clean = function () {
    this._logs.length = 0;
    this._debug = null;
    this._isLoadRes = false;
  };
  t.prototype._getDebug = function () {
    var e;
    var t = this;
    if (!(this._isLoadRes || (null === (e = GameConfig.default.appConfig) || undefined === e ? undefined : e.Publish))) {
      this._isLoadRes = true;
      ResLoader.default.loadRes(BundleConfig.BundleNames.Resouce, "res/common/UI_Debug", cc.Prefab).then(function (e) {
        var o = ResUtil.ResUtil.instantiate(e);
        cc.director.getScene().getChildByName("Canvas").getChildByName("UITips").addChild(o);
        t._debug = o.getComponent(UI_Debug.default);
        t._doDebug();
      });
    }
  };
  t.prototype._doDebug = function () {
    this._debug.refresh(this._logs);
  };
  return t;
}(SingletonManager.SingletonMgr);
exports.DebugMgr = l.getInstance();